        <div class="navbar navbar-inverse navbar-fixed-top eb-topnav">
            <div class="navbar-inner">
                <div class="container">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a>
                    <a class="brand" href="mainpage">眼缘</a>
                    <div class="nav-collapse eb-menu">
                        <div class="nav_hover"></div>
                        <ul class="nav eb-main-menu">
                            <li>
                                <a href="mainpage">首页</a>
                            </li>
                            <li>
                                <a href="post/all">帖子列表</a>
                            </li>
                            <li>
                                <a href="face/wall">真相墙</a>
                            </li>
                            <li>
                                <a href="help">帮助</a>
                            </li>
                        </ul>
						<!--
                        <div class="navbar-search">
                            <input type="text" class="search-query" placeholder="搜索帖子、找人...">
                            <a href="javascript:void(0);"><i class="icon-search" id="nav_search_btn"></i></a>
                        </div>
						-->
                        <!--
                        <div class="navbar-search form-search">
                            <div class="input-append">
                                <input type="text" class="span2 search-query" placeholder="搜索帖子、找人..." />
                                <button type="button" class="btn" style="margin-top:0;"><i class="icon-search"></i></button>
                            </div>
                        </div>
                        -->
                        <ul class="nav pull-right">
                        <?php
                            if (isset($error_404)) {
                            } elseif (isset($_SESSION['userinfo'])) {
                                echo '
                                    <li>
                                        <a href="post">发帖</a>
                                    </li>
                                    <li class="nav_msg_li">
                                        <a href="home/' . $_SESSION['userinfo']['user_id'] . '">'
                                            . $_SESSION['userinfo']['nickname'] . '
                                        </a>
                                        <div class="nav_msg_div">
                                            <button class="close pull-right">&times;</button>
                                            <div id="nav_msg_part" class="hide">
                                                <span class="nav_msg_num">0</span> 条
                                                <a href="home/' . $_SESSION['userinfo']['user_id'] . '#msg">新回复</a>
                                            </div>                                          
                                            <span id="nav_msg_optional_info" class="hide">去完善<a id="nav_msg_change_optional" href="javascript:void(0)">个人资料</a></span>
                                        </div>
                                    </li>
                                    <!--
                                    <div class="user_menu_div">
                                        <ul class="user_menu">
                                            <li><a href="profile/show_profile_form">个人资料</a></li>
                                            <li><a href="profile/show_profile_password">修改密码</a></li>
                                            <li class="divider"></li>
                                            <li><a href="login/logout">注销</a></li>
                                        </ul>
                                    </div>
                                    -->
                                    <!--
                                    <li>
                                        <a href="post" class="nav_icon" title="发帖">
                                            <span class="icomoon-pencil"></span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:void(0);" class="nav_icon">
                                            <span class="icomoon-envelope"></span>
                                        </a>
                                    </li>
                                    -->
                                    <li class="dropdown">
                                        <a href="javascript:void(0);" class="nav_icon" data-toggle="dropdown" title="消息">
                                            <span class="icomoon-envelope"></span>
                                            <span class="nav_msg_num nav_msg_badge badge badge-important"></span>
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li>
                                                <a href="home/' . $_SESSION['userinfo']['user_id'] . '#msg">
                                                    <span class="nav_msg_num pull-right"></span>
                                                    <i class="icon-comment"></i>新回复
                                                </a>
                                            </li>
                                            <!--
                                            <li>
                                                <a href="home/' . $_SESSION['userinfo']['user_id'] . '#letter">
                                                    <span class="pull-right"></span>
                                                    <i class="icon-envelope"></i>新私信
                                                </a>
                                            </li>
                                            -->
                                        </ul>  
                                    </li>
                                    <li class="dropdown">
                                        <a href="javascript:void(0);" class="nav_icon" data-toggle="dropdown" title="设置">
                                            <span class="icomoon-cog"></span>
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li><a href="profile/show_profile_form"><i class="icon-user"></i>个人资料</a></li>
                                            <li><a href="profile/show_profile_password"><i class="icon-lock"></i>修改密码</a></li>
                                            <li class="divider"></li>
                                            <li><a href="login/logout"><i class="icon-off"></i>注销</a></li>
                                        </ul>                                        
                                    </li>
                                ';
                            }
                            else if(isset($_SESSION['unverified_userinfo'])) {
                                echo '
                                    <li>
                                        <a href="login/logout">注销</a>
                                    </li>
                                    <li>
                                        <a href="security/sendVerifyEmail">发送邮箱验证邮件</a>
                                    </li>
                                    ';
                            }
                            else {
                                echo '
                                    <li>
                                        <a data-toggle="modal" href="#login_modal">登陆</a>
                                    </li>
                                    <li>
                                        <a href="register/index">注册</a>
                                    </li>
                                ';
                            }
                        ?>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <?php $this->load->view('login_modal'); ?>

        <?php
            $index = -1;
            $uristr = $this->uri->uri_string();
            if (($uristr === '') || ($uristr === 'mainpage')) {
                $index = 0;
            } elseif ($uristr === 'post/all') {
                $index = 1;
            } elseif ($uristr === 'face/wall') {
                $index = 2;
            } elseif ($uristr === 'help') {
                $index = 3;
            } elseif ($uristr === 'post') {
                $index = 4;
            } elseif (strncmp($uristr, 'home', 4) === 0) {
                $index = 5;
            }

            echo '
                <script type="text/javascript">
                    if (' . $index . ' != -1) {
                        $(\'.navbar .nav li:nth(' . $index . ')\').addClass(\'active\');
                    }
                </script>
            ';
        ?>
